//
//  ViewController.m
//  ty
//
//  Created by cf on 2017/6/22.
//  Copyright © 2017年 caofei. All rights reserved.
//

#import "ViewController.h"

#define MAS_SHORTHAND
#define MAS_SHORTHAND_GLOBALS
#import "Masonry.h"


#import "BKAddView.h"

@interface ViewController ()

@property (nonatomic,strong) BKAddView * aview;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];


    
    [self.view addSubview:self.aview];
    [self.aview makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
    [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(asdf) userInfo:nil repeats:YES];
    
}
-(BKAddView * )aview{
    if (!_aview) {
        _aview = [BKAddView new];
    }
    return _aview;
}

-(void)asdf{
    NSLog(@"aaaaaa");
    UIView * a = [UIView new];
    [a setBackgroundColor:[self random]];
    [self.aview addview:a];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(UIColor *)random{
    int R = (arc4random() % 256) ;
    int G = (arc4random() % 256) ;
    int B = (arc4random() % 256) ;
    return [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1];
    
}
@end
